package 异常处理;

import java.util.Date;
import java.util.Scanner;


class Loan{
    double annualInterestRate = 2.5;
    int numberOfYears = 1;
    double loanAmount = 100;
    java.util.Date loanDate;

    public Loan() {
    }

    public Loan(double annualInterestRate, int numberOfYears, double loanAmount) throws IllegalArgumentException{
        this.annualInterestRate = annualInterestRate;
        this.numberOfYears = numberOfYears;
        this.loanAmount = loanAmount;
        this.loanDate = new Date();

        if (annualInterestRate <= 0) {
            throw new IllegalArgumentException("Annual interest rate must be positive");
        }
        if (numberOfYears <= 0) {
            throw new IllegalArgumentException("Number of years must be positive");
        }
        if (loanAmount <= 0) {
            throw new IllegalArgumentException("Loan amount must be positive");
        }
    }

    public double getAnnualInterestRate() {
        return annualInterestRate;
    }

    public void setAnnualInterestRate(double annualInterestRate) {
        this.annualInterestRate = annualInterestRate;
    }

    public int getNumberOfYears() {
        return numberOfYears;
    }

    public void setNumberOfYears(int numberOfYears) {
        this.numberOfYears = numberOfYears;
    }

    public double getLoanAmount() {
        return loanAmount;
    }

    public void setLoanAmount(double loanAmount) {
        this.loanAmount = loanAmount;
    }

    double getMonthlyPayment(){

        return (loanAmount * annualInterestRate/12)/(1-(1/Math.pow(1+annualInterestRate/12,(numberOfYears * 12))));

    }

    double getTotalPayment(){

        return  getMonthlyPayment() * numberOfYears * 12;

    }
}

public class 贷款 {
    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);

        while (input.hasNext()) {
            double AIR = input.nextDouble();
            int NOY = input.nextInt();
            double LA = input.nextDouble();

            try {
                Loan m = new Loan(AIR, NOY, LA);
                System.out.printf("%.3f\n",m.getTotalPayment());
            } catch (IllegalArgumentException ex) {
                System.out.println(ex);
            }

        }


    }
}
